* Wood and Grose, 2020
* Appendix L code (and CCES mentions in main text)
* uses data file "CCES_cumulative_2006_2018_with_scandals.dta"

*CC320b House approval

gen disapproval_rep_4pt=approval_rep
recode disapproval_rep_4pt (5=.)
recode disapproval_rep_4pt (8=.)
recode disapproval_rep_4pt (9=.)
recode disapproval_rep_4pt (7=.)

*Note, scale is coded 4=strongly disapprove; 3=disapprove; 2=approve; 1=strongly approve so need to rescale Dep. Var.
gen approval_4pt=1 if disapproval_rep_4pt==4
recode approval_4pt (.=2) if disapproval_rep_4pt==3
recode approval_4pt (.=3) if disapproval_rep_4pt==2
recode approval_4pt (.=4) if disapproval_rep_4pt==1

*Create dichotomous disapproval measure. 1=disapprove; 0=approve
gen disapprove_dichotomous=1 if disapproval_rep_4pt==4|disapproval_rep_4pt==3
recode disapprove_dichotomous (.=0) if disapproval_rep_4pt==2|disapproval_rep_4pt==1

*Preliminary Analyses (not in paper)
reg approval_4pt cfscandal otherscandal_notcf, robust cluster(cd)
logit disapprove_dichotomous cfscandal otherscandal_notcf, robust cluster(cd)

*Took party ID with ind. leaners coded as party and created 3 if independent (no leaners) or "not sure" - but not using this
gen pid3_leaner_recode=3 if pid3_leaner==8
*Code so Dem PID is 1
recode pid3_leaner_recode (.=1) if pid3_leaner==1
*Code so GOP PID is 3 in pid3_leaner_recode
recode pid3_leaner_recode (.=3) if pid3_leaner==2
*Code so Ind PID is 2 in pid3_leaner_recoe
recode pid3_leaner_recode (.=2) if pid3_leaner==3
tab pid3_leaner_recode

*Create dummy variables for Dem voters and GOP voters
gen demvoter=1 if pid3==1
recode demvoter (.=0)
gen gopvoter=1 if pid3==2
recode gopvoter (.=0)

*Created variables for party of the House rep
*rep_party is the string variables for party (D, R, I, DFL, etc.)
*House_rep_dem 1=Democratic House rep (includes miscoded 'Bud Cramer' and DFL); 0=not
*House_rep_gop 1=Republican House rep (includes 'formerly John McHugh); 0=not
*House_rep_ind 1=Independent House rep; 0=not

*Create interaction of D voters & D House reps
gen demvoter_x_House_rep_dem=demvoter*House_rep_dem
*Create interaction of D voters & R House reps
gen demovoter_x_House_rep_gop=demvoter*House_rep_gop
*Create interaction of R voters & D House reps
gen gopvoter_x_House_rep_dem=gopvoter*House_rep_dem
*Create interaction of R voters & R House reps
gen gopvoter_x_House_rep_gop=gopvoter*House_rep_gop

* Note that we report one-tailed p values throughout, except as discussed in table notes
*Model 1/respondents
reg approval_4pt cfscandal otherscandal_notcf demvoter gopvoter House_rep_dem House_rep_gop demvoter_x_House_rep_dem demovoter_x_House_rep_gop gopvoter_x_House_rep_dem gopvoter_x_House_rep_gop , robust cluster(cd) level(90)

*Model 2/validated voters only
reg approval_4pt cfscandal otherscandal_notcf demvoter gopvoter House_rep_dem House_rep_gop demvoter_x_House_rep_dem demovoter_x_House_rep_gop gopvoter_x_House_rep_dem gopvoter_x_House_rep_gop if vv_regstatus==1, robust cluster(cd) level(90)

*Model 3/respondents
logit disapprove_dichotomous cfscandal otherscandal_notcf demvoter gopvoter House_rep_dem House_rep_gop demvoter_x_House_rep_dem demovoter_x_House_rep_gop gopvoter_x_House_rep_dem gopvoter_x_House_rep_gop , robust cluster(cd) level(90)

*Model 4/validated voters only
logit disapprove_dichotomous cfscandal otherscandal_notcf demvoter gopvoter House_rep_dem House_rep_gop demvoter_x_House_rep_dem demovoter_x_House_rep_gop gopvoter_x_House_rep_dem gopvoter_x_House_rep_gop if vv_regstatus==1, robust cluster(cd) level(90)




